#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include "led.h"
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    led(new LED())// 创建 LED 对象的实例，并分配内存
{
    ui->setupUi(this);
    this->setFixedSize(800, 480);
    setWindowTitle("Linux 屏幕主界面程序");
    connect(led, &LED::updateLEDButtonText, this, &MainWindow::setLedButtonText);

}

MainWindow::~MainWindow()
{
    delete ui;
    delete led;  // 释放内存
}



//修改按钮名字
void MainWindow::setLedButtonText(const QString &text) {
    ui->led_button->setText(text);
}

void MainWindow::on_led_button_clicked()
{
    /* 设置LED的状态 */
    led->setLedState();
}

